package com.yihusitian.leecode.algorithm.easy;


public class ReverseString {

    public void reverseString(char[] s) {
        if (s == null || s.length == 0) {
            return;
        }

        int left  = 0;
        int right = s.length - 1;
        while (left <= right) {
            char temp = s[left];
            s[left] = s[right];
            s[right] = temp;
            left++;
            right--;
        }
    }

    public static void main(String[] args) {
        char[] chars = "abcdefg".toCharArray();
        new ReverseString().reverseString(chars);
        System.out.println(new String(chars));
    }

}
